/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Johnny
 */
@Entity
@Table(catalog = "celulares", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Ingreso.findAll", query = "SELECT i FROM Ingreso i"),
    @NamedQuery(name = "Ingreso.findByIdingresos", query = "SELECT i FROM Ingreso i WHERE i.idingresos = :idingresos"),
    @NamedQuery(name = "Ingreso.findByFecha", query = "SELECT i FROM Ingreso i WHERE i.fecha = :fecha"),
    @NamedQuery(name = "Ingreso.findByHora", query = "SELECT i FROM Ingreso i WHERE i.hora = :hora"),
    @NamedQuery(name = "Ingreso.findByValor", query = "SELECT i FROM Ingreso i WHERE i.valor = :valor")})
public class Ingreso
  implements Serializable
{
  private static final long serialVersionUID = 1L;

  @Id
  @GeneratedValue(strategy=GenerationType.IDENTITY)
  @Basic(optional=false)
  @Column(nullable=false)
  private Integer idingresos;

  @Temporal(TemporalType.DATE)
  private Date fecha;

  @Column(length=45)
  private String hora;

  @Lob
  @Column(length=65535)
  private String concepto;

  @Column(precision=22)
  private Double valor;

  @JoinColumn(name="idUsuario", referencedColumnName="nick")
  @ManyToOne
  private Usuario idUsuario;

  public Ingreso()
  {
  }

  public Ingreso(Integer idingresos)
  {
    this.idingresos = idingresos;
  }

  public Integer getIdingresos() {
    return this.idingresos;
  }

  public void setIdingresos(Integer idingresos) {
    this.idingresos = idingresos;
  }

  public Date getFecha() {
    return this.fecha;
  }

  public void setFecha(Date fecha) {
    this.fecha = fecha;
  }

  public String getHora() {
    return this.hora;
  }

  public void setHora(String hora) {
    this.hora = hora;
  }

  public String getConcepto() {
    return this.concepto;
  }

  public void setConcepto(String concepto) {
    this.concepto = concepto;
  }

  public Double getValor() {
    return this.valor;
  }

  public void setValor(Double valor) {
    this.valor = valor;
  }

  public Usuario getIdUsuario() {
    return this.idUsuario;
  }

  public void setIdUsuario(Usuario idUsuario) {
    this.idUsuario = idUsuario;
  }

  public int hashCode()
  {
    int hash = 0;
    hash += (this.idingresos != null ? this.idingresos.hashCode() : 0);
    return hash;
  }

  public boolean equals(Object object)
  {
    if (!(object instanceof Ingreso)) {
      return false;
    }
    Ingreso other = (Ingreso)object;
    if (((this.idingresos == null) && (other.idingresos != null)) || ((this.idingresos != null) && (!this.idingresos.equals(other.idingresos)))) {
      return false;
    }
    return true;
  }

  public String toString()
  {
    return "com.mycompany.entidades.Ingreso[ idingresos=" + this.idingresos + " ]";
  }
}